package test;
//import org.xmap.ui.effect.MatCube;
import org.xmap.app.App;
import org.xmap.app.Env;
import org.xmap.ui.ViewManager;
import org.xmap.ui.base.Window;
import org.xmap.ui.views.TextAreaView;
import org.xmap.ui.View;

public class XmapDemoView extends TextAreaView {
//    private ParticleGroup pg;
//    private Flame flame;
//    private MatCube mc;

    public XmapDemoView() {
        this.setTitleText("Xmap演示程序");
//        this.setBgColor(0xffe6f7ff);
        this.setRightMenu("退出");
        this.addLeftMenu("Label");
        this.addLeftMenu("MessageBox");
        this.addLeftMenu("Guage");
        this.addLeftMenu("TextArea");
        this.addLeftMenu("Bitmap");
        if (Env.instance.hasPointerEvents) {
            this.addLeftMenu("PointerKeyboard");
        }
        this.addLeftMenu("TextField");
        this.addLeftMenu("SimpleMenu");
        this.addLeftMenu("ImageGrid");
        this.addLeftMenu("List");
        this.addLeftMenu("Fading");
        this.addText("选择左侧菜单进入各个控件的演示界面。");
        this.addText("选择退出菜单结束演示程序。");
        this.addText("*键打开或关闭内存和帧速率显示开关。");
        this.addText("#键切换到调试信息界面。");
//        this.pg = new ParticleGroup(0, 0, this.getRect().width, this.getRect().height, 100);
//        this.flame = new Flame(0, 80, 30, 50);
//        this.mc = new MatCube(50, 80, 30, 50);
//        this.addControls(this.pg);
//        this.addControls(this.flame);
//        this.addControls(this.mc);
    }

    public void commandEvent(String command, Window sender) {
        if (command.equals("Label")) {
            ViewManager.instance.setView(new LabelView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("MessageBox")) {
            ViewManager.instance.setView(new MessageBoxView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("Guage")) {
            ViewManager.instance.setView(new GuageView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("TextArea")) {
            ViewManager.instance.setView(new test.TextAreaView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("Bitmap")) {
            ViewManager.instance.setView(new BitmapView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("PointerKeyboard")) {
            ViewManager.instance.setView(new KeyboardView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("TextField")) {
            ViewManager.instance.setView(new TextFieldView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("SimpleMenu")) {
            ViewManager.instance.setView(new SimpleMenuView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("ImageGrid")) {
            ViewManager.instance.setView(new ImageGridView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("List")) {
            ViewManager.instance.setView(new test.ListView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("Fading")) {
            ViewManager.instance.setView(new FadingView(this), View.ANIMATION_RIGHT_TO_LEFT);
        } else if (command.equals("退出")) {
            App.destroy();
        }
    }
}
